﻿using System.Collections;
using System.Xml;

namespace LD.Host.Mes
{
    public class MesHelperDpt
    {
        public static bool Post(string data)
        {
            string url = (string)Cache.GetCache(CONST.DPT_URL);
            Hashtable hashtable = new Hashtable();
            hashtable.Add("barcode", data);

            Log4.Info("MES请求:" + data);

            XmlDocument result = WebServiceCaller.QuerySoapWebService(url,
                                                                      "BarCodeSend",
                                                                      hashtable);
            Log4.Info("MES返回:" + result.InnerText);

            if (result.InnerText == null)
            {
                Log4.Info("MES无返回数据");
                return false;
            }
            //var mesRep = Newtonsoft.Json.JsonConvert.DeserializeObject<TestData>(result.InnerText);
            //if (mesRep == null)
            //{
            //    Log4.Info("MES无返回数据");
            //    return false;
            //}
            else
            {
                if (result.InnerText.Substring(0, 1).Equals("1"))
                    return true;
                else
                    return false;
            }
        }
    }
}
